package canglang.monitor.cases.service.impl;

import canglang.monitor.cases.dao.CaseNineDAO;
import canglang.monitor.cases.model.CaseNineModel;
import canglang.monitor.cases.service.CaseNineMgr;
import canglang.monitor.cases.to.SearchNineTO;
import canglang.monitor.core.base.pagination.PaginatedListHelper;

import java.util.List;

public class CaseNineMgrImpl implements CaseNineMgr {

	private CaseNineDAO caseNineDAO;

	public void setCaseNineDAO(CaseNineDAO caseNineDAO) {
		this.caseNineDAO = caseNineDAO;
	}

	public CaseNineModel addCaseNine(CaseNineModel caseNineModel) {
		int id=caseNineDAO.addCaseNine(caseNineModel);
		return caseNineDAO.getCaseNine(id);
	}

	public CaseNineModel getCaseNine(int caseNineId) {
		return caseNineDAO.getCaseNine(caseNineId);
	}

	public CaseNineModel saveCaseNine(CaseNineModel caseNineModel) {
        return caseNineDAO.saveCaseNine(caseNineModel);
	}

	public void deleteCaseNine(int caseNineId) {
		caseNineDAO.deleteCaseNine(caseNineId);
	}

    public PaginatedListHelper search(PaginatedListHelper helper, SearchNineTO searchTO){
        int count = caseNineDAO.searchCount(searchTO);
        helper.setFullListSize(count);
        List list = caseNineDAO.searchList(helper, searchTO);
        helper.setList(list);
        return helper;
    }

     public List getCaseNineList(SearchNineTO searchTO){
        return caseNineDAO.getCaseNineList(searchTO);
    }
}